Skip to content

feat: add ASOF join logical semantics - #23829

Merged
2010YOUY01 merged 3 commits into
apache:mainfrom
Xuanwo:xuanwo/asof-logical
Sep 4, 2026
Merged

feat: add ASOF join logical semantics#23829
2010YOUY01 merged 3 commits into
apache:mainfrom
Xuanwo:xuanwo/asof-logical

Conversation

@Xuanwo

@Xuanwo Xuanwo commented Jul 23, 2026

Copy link
Copy Markdown
Member

Which issue does this PR close?

Rationale for this change

This is the logical-planning layer of the ASOF JOIN stack. It defines the
logical contract and planner behavior separately from the SQL frontend and
serialization formats.

#23828 is merged, so this PR's diff against main is the isolated logical
layer. It no longer depends on the optional floating-point follow-up #24375.

What changes are included in this PR?

  • Add LogicalPlan::AsOfJoin, AsOfJoin, and AsOfMatch.
  • Validate deterministic expressions, input ownership, supported match
    operators, equality-key types, and USING constraints.
  • Add LogicalPlanBuilder entry points and schema construction that preserves
    both qualified USING keys while exposing one unqualified wildcard key.
  • Integrate ASOF joins with tree transforms, display, type coercion, projection
    pruning, row bounds, and physical planning.
  • Plan logical ASOF joins to the broadcast-based AsOfJoinExec from feat: add ASOF join physical operator #23828.
  • Fail closed at proto, SQL unparser, and Substrait boundaries until their
    owning stack layers add explicit support.
  • Defer ASOF-specific functional-dependency refinement to perf: preserve left functional dependencies for ASOF joins #24799 and filter
    pushdown to perf: push left filters through ASOF joins #24801 so each optimization can be reviewed independently.

Are these changes tested?

Yes:

  • cargo fmt --all
  • cargo clippy --all-targets --all-features -- -D warnings
  • cargo test -p datafusion-expr min_rows_of_joins --all-features
  • cargo test -p datafusion-substrait asof_join_fails_closed_until_substrait_has_an_extension --all-features
  • The extended workspace test command from the contributor guide

Are there any user-facing changes?

This adds logical-plan and builder APIs for ASOF joins. SQL syntax, DataFrame
APIs, and plan serialization are intentionally left to dependent stack PRs.
Floating equality keys remain rejected by the merged physical operator unless
the independent follow-up #24375 is also included.

As with any new public LogicalPlan variant, downstream exhaustive matches must
add an arm. The variant is appended so existing variants retain their
PartialOrd ordering; maintainers should still treat the enum addition as a
Rust source-compatibility break.

This PR can be reviewed independently now that #23828 has merged. The
optimization follow-ups #24799 and #24801 are not required by the core ASOF
stack.

@github-actions github-actions Bot added sql SQL Planner logical-expr Logical plan and expressions optimizer Optimizer rules core Core DataFusion crate substrait Changes to the substrait crate proto Related to proto crate physical-plan Changes to the physical-plan crate labels Jul 23, 2026
@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown

Thank you for opening this pull request!

Reviewer note: cargo-semver-checks reported the current version number is not SemVer-compatible with the changes in this pull request (compared against the base branch).

Details
     Cloning apache/main
    Building datafusion v55.0.0 (current)
       Built [  63.630s] (current)
     Parsing datafusion v55.0.0 (current)
      Parsed [   0.038s] (current)
    Building datafusion v55.0.0 (baseline)
       Built [  62.116s] (baseline)
     Parsing datafusion v55.0.0 (baseline)
      Parsed [   0.039s] (baseline)
    Checking datafusion v55.0.0 -> v55.0.0 (no change; assume patch)
     Checked [   0.928s] 223 checks: 223 pass, 31 skip
     Summary no semver update required
    Finished [ 129.033s] datafusion
    Building datafusion-expr v55.0.0 (current)
       Built [  31.273s] (current)
     Parsing datafusion-expr v55.0.0 (current)
      Parsed [   0.082s] (current)
    Building datafusion-expr v55.0.0 (baseline)
       Built [  30.907s] (baseline)
     Parsing datafusion-expr v55.0.0 (baseline)
      Parsed [   0.083s] (baseline)
    Checking datafusion-expr v55.0.0 -> v55.0.0 (no change; assume patch)
     Checked [   1.853s] 223 checks: 222 pass, 1 fail, 0 warn, 31 skip

--- failure enum_variant_added: enum variant added on exhaustive enum ---

Description:
A publicly-visible enum without #[non_exhaustive] has a new variant.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#enum-variant-new
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.50.0/src/lints/enum_variant_added.ron

Failed in:
  variant LogicalPlan:AsOfJoin in /home/runner/work/datafusion/datafusion/datafusion/expr/src/logical_plan/plan.rs:301
  variant LogicalPlan:AsOfJoin in /home/runner/work/datafusion/datafusion/datafusion/expr/src/logical_plan/plan.rs:301

     Summary semver requires new major version: 1 major and 0 minor checks failed
    Finished [  65.491s] datafusion-expr
    Building datafusion-optimizer v55.0.0 (current)
       Built [  28.977s] (current)
     Parsing datafusion-optimizer v55.0.0 (current)
      Parsed [   0.033s] (current)
    Building datafusion-optimizer v55.0.0 (baseline)
       Built [  28.583s] (baseline)
     Parsing datafusion-optimizer v55.0.0 (baseline)
      Parsed [   0.034s] (baseline)
    Checking datafusion-optimizer v55.0.0 -> v55.0.0 (no change; assume patch)
     Checked [   0.226s] 223 checks: 223 pass, 31 skip
     Summary no semver update required
    Finished [  58.910s] datafusion-optimizer
    Building datafusion-physical-plan v55.0.0 (current)
       Built [  40.299s] (current)
     Parsing datafusion-physical-plan v55.0.0 (current)
      Parsed [   0.164s] (current)
    Building datafusion-physical-plan v55.0.0 (baseline)
       Built [  40.592s] (baseline)
     Parsing datafusion-physical-plan v55.0.0 (baseline)
      Parsed [   0.173s] (baseline)
    Checking datafusion-physical-plan v55.0.0 -> v55.0.0 (no change; assume patch)
     Checked [   1.069s] 223 checks: 223 pass, 31 skip
     Summary no semver update required
    Finished [  83.760s] datafusion-physical-plan
    Building datafusion-proto v55.0.0 (current)
       Built [  57.857s] (current)
     Parsing datafusion-proto v55.0.0 (current)
      Parsed [   0.019s] (current)
    Building datafusion-proto v55.0.0 (baseline)
       Built [  58.197s] (baseline)
     Parsing datafusion-proto v55.0.0 (baseline)
      Parsed [   0.020s] (baseline)
    Checking datafusion-proto v55.0.0 -> v55.0.0 (no change; assume patch)
     Checked [   0.172s] 223 checks: 223 pass, 31 skip
     Summary no semver update required
    Finished [ 117.727s] datafusion-proto
    Building datafusion-sql v55.0.0 (current)
       Built [  46.275s] (current)
     Parsing datafusion-sql v55.0.0 (current)
      Parsed [   0.035s] (current)
    Building datafusion-sql v55.0.0 (baseline)
       Built [  46.246s] (baseline)
     Parsing datafusion-sql v55.0.0 (baseline)
      Parsed [   0.037s] (baseline)
    Checking datafusion-sql v55.0.0 -> v55.0.0 (no change; assume patch)
     Checked [   0.329s] 223 checks: 223 pass, 31 skip
     Summary no semver update required
    Finished [  94.340s] datafusion-sql
    Building datafusion-substrait v55.0.0 (current)
       Built [ 314.635s] (current)
     Parsing datafusion-substrait v55.0.0 (current)
      Parsed [   0.019s] (current)
    Building datafusion-substrait v55.0.0 (baseline)
       Built [ 319.294s] (baseline)
     Parsing datafusion-substrait v55.0.0 (baseline)
      Parsed [   0.019s] (baseline)
    Checking datafusion-substrait v55.0.0 -> v55.0.0 (no change; assume patch)
     Checked [   0.328s] 223 checks: 223 pass, 31 skip
     Summary no semver update required
    Finished [ 636.849s] datafusion-substrait

@github-actions github-actions Bot added the auto detected api change Auto detected API change label Jul 23, 2026
@codecov-commenter

codecov-commenter commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 30.34301% with 264 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.48%. Comparing base (c4910e0) to head (65752d9).
⚠️ Report is 20 commits behind head on main.

Files with missing lines Patch % Lines
datafusion/expr/src/logical_plan/plan.rs 40.51% 101 Missing and 15 partials ⚠️
datafusion/expr/src/logical_plan/tree_node.rs 0.00% 43 Missing ⚠️
datafusion/core/src/physical_planner.rs 0.00% 41 Missing ⚠️
datafusion/optimizer/src/analyzer/type_coercion.rs 0.00% 28 Missing ⚠️
datafusion/expr/src/logical_plan/builder.rs 60.71% 17 Missing and 5 partials ⚠️
datafusion/expr/src/logical_plan/display.rs 0.00% 10 Missing ⚠️
datafusion/optimizer/src/optimizer.rs 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             main   #23829     +/-   ##
=========================================
  Coverage   81.47%   81.48%             
=========================================
  Files        1122     1123      +1     
  Lines      403629   406478   +2849     
  Branches   403629   406478   +2849     
=========================================
+ Hits       328866   331212   +2346     
- Misses      55510    55880    +370     
- Partials    19253    19386    +133     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Xuanwo
Xuanwo force-pushed the xuanwo/asof-logical branch from 1a925ce to eace163 Compare August 28, 2026 05:40
@github-actions github-actions Bot removed physical-expr Changes to the physical-expr crates physical-plan Changes to the physical-plan crate labels Aug 28, 2026
@Xuanwo
Xuanwo marked this pull request as ready for review August 28, 2026 05:53
@Xuanwo

Xuanwo commented Aug 28, 2026

Copy link
Copy Markdown
Member Author

cc @2010YOUY01 & @jayzhan211, we can work on this PR now!

@jayzhan211 jayzhan211 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Xuanwo , LGTM

@Xuanwo

Xuanwo commented Aug 30, 2026

Copy link
Copy Markdown
Member Author

Thanks @Xuanwo , LGTM

Thank you @jayzhan211 for the review 🥰

@2010YOUY01 2010YOUY01 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, this is great. Could you wait a few days? I need more time to review.

After a quick look, I'm wondering whether it's possible to remove the two pure optimizations marked below and add them in follow-up PRs.

They seem quite tricky, and we've had many related bugs before, so we should add more test coverage targeting those specific optimizations, and potentially better explain the mechanism and hidden assumptions in the separate PRs.

Comment thread datafusion/expr/src/logical_plan/builder.rs Outdated
Comment thread datafusion/optimizer/src/push_down_filter.rs Outdated
Comment thread datafusion/expr/src/logical_plan/plan.rs
Comment thread datafusion/expr/src/logical_plan/plan.rs
@github-actions github-actions Bot added the physical-plan Changes to the physical-plan crate label Aug 30, 2026
@Xuanwo

Xuanwo commented Aug 30, 2026

Copy link
Copy Markdown
Member Author

Thank you, this is great. Could you wait a few days? I need more time to review.

Sure, take your time! I have moved some independent optimizations in to dedicated PRs as follow-ups.

@Xuanwo
Xuanwo requested a review from 2010YOUY01 September 1, 2026 15:58

@2010YOUY01 2010YOUY01 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you.

My main suggestion is to simplify the logical plan builder API, but we could potentially defer that to the SQL integration PR, since it will be easier to validate at that point.

physical_right,
join_on,
match_condition,
None,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is something I don't fully understand — it would be great if other reviewers have the knowledge to double-check, or can point me to something that would help me understand it more easily. (Just flagging where I don't have full confidence; I don't think this is a blocker for this PR.)

Specifically, I don't follow the whole lifecycle of projection pushdown.

Let's say the downstream only requires a subset of the columns inside AsOfJoinExec. I imagine the logical optimizer should try to keep the projection list inside the LogicalPlan, so that we can directly build the physical plan node with the required projection indices.

Here, when building the initial physical plan, the projection list is None, and it seems to depend on a later physical optimizer pass to finish the work.

Perhaps there is some room to simplify that process.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. I’ll handle that in a separate follow-up.

Comment on lines +1015 to +1016
on: Vec<(Expr, Expr)>,
match_condition: AsOfMatch,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is the user-facing API (see the example code in the join_on comment above), so it should be easy to use.
Currently it asks callers to manually normalize the args; instead, we should validate them internally.

Perhaps:

on: Expr,
match_condition: Expr,

For example, if the SQL input is on t1.v1 < t2.v1, which is not a supported ON clause for an asof join:

  • Existing design: we have to do partial validation in the SQL->LogicalPlan binding
  • Alternative: we can consolidate the validation in one place

But I think we can proceed as is and potentially change it in the SQL integration PR. It would be obvious which design is better once we try to build a plan from SQL. And we're likely to do that before the next release, so API changes are fine.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. Should be fixed in #23830

impl AsOfJoin {
/// Creates an ASOF join and validates its logical contract.
///
/// This is the pre-coercion boundary. The physical ASOF constructor repeats

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find Join::try_new() (in the current file) don't do any validation, maybe it's allowed to build invalid logical plan, and defer validation to the physical plan construction?

After SQL integration we can try if we can delete the validation here to simplify it, it's always better if we can consolidate all the related validation to a single place.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think AsOfJoin::try_new should stay as the logical invariant boundary, while the physical constructor validates the post-coercion execution contract. #23830 now removes the SQL-side duplicate parsing and delegates it to the builder.

@2010YOUY01
2010YOUY01 added this pull request to the merge queue Sep 4, 2026
Merged via the queue into apache:main with commit e1942b1 Sep 4, 2026
42 checks passed
github-merge-queue Bot pushed a commit that referenced this pull request Sep 9, 2026
## Which issue does this PR close?

- Part of #318.
- Umbrella PR: #23738.
- Builds on #23829 and #23828, both merged.

## Rationale for this change

This is the SQL frontend layer of the ASOF JOIN stack. It adds syntax
and
unparsing on top of the merged physical and logical contracts. The PR
now
contains only the isolated SQL frontend diff.

## What changes are included in this PR?

- Plan `ASOF JOIN ... MATCH_CONDITION (...)` with optional `ON` or
`USING`
  equality keys.
- Reject unsupported match shapes and non-equality `ON` predicates.
- Unparse ASOF joins while preserving right-side candidate preselection
and
  nested join scope.
- Document the supported SQL syntax and semantics, including qualified
`USING` keys, left-partitioned broadcast execution, the full-right
memory
requirement, repeated scans, and the absence of spill/repartitioned
ASOF.
- Add SQL integration and sqllogictest coverage for all four match
directions,
coercion, equality-free joins, USING, invalid contracts, EXPLAIN,
boundedness,
  and optimized-plan round trips.
- Verify the broadcast topology with a multi-partition left input: left
  partitioning is preserved while the right input is single-partitioned.

## Are these changes tested?

Yes:

- `cargo fmt --all`
- `./ci/scripts/doc_prettier_check.sh --write --allow-dirty`
- `cargo clippy --all-targets --all-features -- -D warnings`
- `cargo test -p datafusion --test core_integration asof --all-features`
- `cargo test -p datafusion-sqllogictest --test sqllogictests
--all-features -- asof_join`
- The extended workspace test command from the contributor guide

## Are there any user-facing changes?

Users can express Snowflake-style ASOF joins in SQL with
`MATCH_CONDITION`, optional equality keys, and `<`, `<=`, `>`, or `>=`
match
directions. With `USING`, wildcard output exposes one unqualified key
while
both qualified input keys remain addressable. The user guide also
documents
the initial broadcast strategy and its memory/no-spill limitations.

#23829 and #23828 are merged. This is the next core layer in the ASOF
stack and
does not depend on the optional floating-point follow-up #24375.
osipovartem added a commit to Embucket/datafusion that referenced this pull request Sep 13, 2026
* feat: add ASOF join physical operator (apache#23828)

## Which issue does this PR close?

- Part of apache#318.
- Umbrella PR: apache#23738.
- Follow-up for floating-point equality keys: apache#24375.

## Rationale for this change

This is the first layer of the ASOF JOIN stack. It establishes a
broadcast-based physical execution contract independently so later
floating-point equality, logical-plan, SQL, DataFrame, and serialization
changes
can be reviewed as smaller follow-up PRs.

The initial implementation deliberately favors the simpler broadcast
design:
the right input must fit in memory and each left partition scans the
shared
right-side batches. A repartitioned implementation can be evaluated
separately
without changing the ASOF semantics introduced here.

Floating-point equality keys are rejected in this base layer because
Arrow's
required sort order distinguishes `-0.0` from `+0.0` while join equality
does
not. apache#24375 adds the required ordering normalization as an independently
reviewable layer.

## What changes are included in this PR?

- Add `AsOfJoinExec` for left-preserving, Snowflake-style ASOF
semantics.
- Coalesce and collect the ordered right input once, then share it
across all
  left partitions.
- Keep the left input partitioned so each partition can scan
independently and
  preserve the left-side output partitioning.
- Preserve merge state across input and output batch boundaries.
- Reserve each retained Arrow buffer exactly once, including when
right-side
batches are zero-copy slices, and expose build, match, and output
metrics.
- Define output properties and statistics for the broadcast execution
model.
- Reject floating-point equality keys until apache#24375 supplies a
sort/equality
  contract that handles signed zero correctly.
- Add physical operator tests covering match directions, equality
groups,
batch boundaries, unmatched rows, invalid contracts, shared-buffer
memory
accounting, multi-partition broadcast execution, and float-key
rejection.

## Are these changes tested?

Yes:

- `cargo fmt --all`
- `cargo clippy --all-targets --all-features -- -D warnings`
- `cargo test -p datafusion-physical-plan joins::asof_join
--all-features`
- Extended workspace tests from the contributor guide
- FFI integration tests

## Are there any user-facing changes?

This adds a new physical operator API. The base operator deliberately
rejects
floating-point equality keys; apache#24375 adds full Float16, Float32, and
Float64
support. SQL and DataFrame APIs are left to later dependent PRs.

---------

Co-authored-by: Yongting You <2010youy01@gmail.com>

* feat: add ASOF join logical semantics (apache#23829)

- Part of apache#318.
- Umbrella PR: apache#23738.
- Depends on apache#23828 (merged).

This is the logical-planning layer of the ASOF JOIN stack. It defines
the
logical contract and planner behavior separately from the SQL frontend
and
serialization formats.

logical
layer. It no longer depends on the optional floating-point follow-up

- Add `LogicalPlan::AsOfJoin`, `AsOfJoin`, and `AsOfMatch`.
- Validate deterministic expressions, input ownership, supported match
  operators, equality-key types, and USING constraints.
- Add `LogicalPlanBuilder` entry points and schema construction that
preserves
both qualified `USING` keys while exposing one unqualified wildcard key.
- Integrate ASOF joins with tree transforms, display, type coercion,
projection
  pruning, row bounds, and physical planning.
- Plan logical ASOF joins to the broadcast-based `AsOfJoinExec` from
- Fail closed at proto, SQL unparser, and Substrait boundaries until
their
  owning stack layers add explicit support.
- Defer ASOF-specific functional-dependency refinement to apache#24799 and
filter
  pushdown to apache#24801 so each optimization can be reviewed independently.

Yes:

- `cargo fmt --all`
- `cargo clippy --all-targets --all-features -- -D warnings`
- `cargo test -p datafusion-expr min_rows_of_joins --all-features`
- `cargo test -p datafusion-substrait
asof_join_fails_closed_until_substrait_has_an_extension --all-features`
- The extended workspace test command from the contributor guide

This adds logical-plan and builder APIs for ASOF joins. SQL syntax,
DataFrame
APIs, and plan serialization are intentionally left to dependent stack
PRs.
Floating equality keys remain rejected by the merged physical operator
unless
the independent follow-up apache#24375 is also included.

As with any new public `LogicalPlan` variant, downstream exhaustive
matches must
add an arm. The variant is appended so existing variants retain their
`PartialOrd` ordering; maintainers should still treat the enum addition
as a
Rust source-compatibility break.

This PR can be reviewed independently now that apache#23828 has merged. The
optimization follow-ups apache#24799 and apache#24801 are not required by the core
ASOF
stack.

* feat: support ASOF JOIN SQL (apache#23830)

- Part of apache#318.
- Umbrella PR: apache#23738.
- Builds on apache#23829 and apache#23828, both merged.

This is the SQL frontend layer of the ASOF JOIN stack. It adds syntax
and
unparsing on top of the merged physical and logical contracts. The PR
now
contains only the isolated SQL frontend diff.

- Plan `ASOF JOIN ... MATCH_CONDITION (...)` with optional `ON` or
`USING`
  equality keys.
- Reject unsupported match shapes and non-equality `ON` predicates.
- Unparse ASOF joins while preserving right-side candidate preselection
and
  nested join scope.
- Document the supported SQL syntax and semantics, including qualified
`USING` keys, left-partitioned broadcast execution, the full-right
memory
requirement, repeated scans, and the absence of spill/repartitioned
ASOF.
- Add SQL integration and sqllogictest coverage for all four match
directions,
coercion, equality-free joins, USING, invalid contracts, EXPLAIN,
boundedness,
  and optimized-plan round trips.
- Verify the broadcast topology with a multi-partition left input: left
  partitioning is preserved while the right input is single-partitioned.

Yes:

- `cargo fmt --all`
- `./ci/scripts/doc_prettier_check.sh --write --allow-dirty`
- `cargo clippy --all-targets --all-features -- -D warnings`
- `cargo test -p datafusion --test core_integration asof --all-features`
- `cargo test -p datafusion-sqllogictest --test sqllogictests
--all-features -- asof_join`
- The extended workspace test command from the contributor guide

Users can express Snowflake-style ASOF joins in SQL with
`MATCH_CONDITION`, optional equality keys, and `<`, `<=`, `>`, or `>=`
match
directions. With `USING`, wildcard output exposes one unqualified key
while
both qualified input keys remain addressable. The user guide also
documents
the initial broadcast strategy and its memory/no-spill limitations.

stack and
does not depend on the optional floating-point follow-up apache#24375.

---------

Co-authored-by: Xuanwo <github@xuanwo.io>
Co-authored-by: Yongting You <2010youy01@gmail.com>
kumarUjjawal pushed a commit to edubraqd/datafusion that referenced this pull request Sep 13, 2026
## Which issue does this PR close?

- Part of apache#318.
- Umbrella PR: apache#23738.
- Follows apache#23829 (merged).

## Rationale for this change

This is the serialization layer of the ASOF JOIN stack. It gives logical
and
physical ASOF plans explicit protobuf representations without coupling
wire
format review to SQL or DataFrame APIs.

apache#23829 and its prerequisites are merged. After restacking onto the
current
`main`, this PR now contains only the serialization layer.

## What changes are included in this PR?

- Add protobuf messages and enum values for logical and physical ASOF
joins.
- Encode and decode equality keys, ordered match expressions, match
direction,
  join constraint, and right output indices.
- Implement physical serialization through `ExecutionPlan::try_to_proto`
and
  `AsOfJoinExec::try_from_proto`, following the current self-serializing
  execution-plan pattern.
- Regenerate `prost` and `pbjson` sources with the repository generator.
The
  physical-plan oneof uses the next append-only tag after
  `PiecewiseMergeJoinExec`.
- Add logical round trips for all four match directions and a physical
  `AsOfJoinExec` round trip.

## Are these changes tested?

Yes:

- `./datafusion/proto-models/regen.sh`
- `cargo fmt --all`
- `cargo clippy --all-targets --all-features -- -D warnings`
- `./dev/rust_lint.sh`
- `cargo test -p datafusion-proto roundtrip_asof_join --all-features`
- The extended workspace test command from the contributor guide

## Are there any user-facing changes?

Logical and physical ASOF join plans can be serialized through
`datafusion-proto`. The additions use new messages and append-only
oneof/enum
tags, so existing wire tags are not reused. Generated public Rust enums
gain new
variants, however, so downstream exhaustive matches must add arms; this
is a
Rust source-compatibility break even though the wire additions are
compatible.

This PR can now be reviewed independently. It does not depend on the
optional
floating-point follow-up apache#24375.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto detected api change Auto detected API change core Core DataFusion crate logical-expr Logical plan and expressions optimizer Optimizer rules physical-plan Changes to the physical-plan crate proto Related to proto crate sql SQL Planner substrait Changes to the substrait crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants